Next | Prev | Up | Top | Contents | Index

Important Warning Messages

When porting a 32-bit application to 64-bits use the -fullwarn option to expose variable size related issues. Two warnings in particular emitted by the 64-bit C compiler are helpful in this respect. They allow you to locate faulty assumptions that integers and pointers are the same size.


warning(1411): destination type of cast is too small to hold all pointers: truncation possible

For example, the following code fragment generates this warning when compiled -64.

unsigned i, *p;
i = (unsigned) p;
In this example, the unsigned integer variable i is set to only the low order 32 bits of p. If p contains an address greater than 32 bits, that address is truncated in i.


warning(1412): source type of cast is too small to hold all pointers: sign extension possible

The following code fragment generates this warning when compiled -64.

int i, *p;
p = (int *) i;
In this example, if i is negative, the sign bit is extended throughout the high-order 32 bits of p. The result is that p contains an invalid address.


Next | Prev | Up | Top | Contents | Index